Skip to content

feat(core): add headers to langsmith_gateway and ignore proxies - #41900

Open
Sai Annam (saiannam-dev) wants to merge 1 commit into
masterfrom
saiannam-dev/core/gateway-headers
Open

Sai Annam (saiannam-dev) wants to merge 1 commit into
masterfrom
saiannam-dev/core/gateway-headers

Conversation

@saiannam-dev

Copy link
Copy Markdown
Contributor

Stack: core → openai → anthropic → groq → xai → deepseek (this PR: core)

Adds headers= to langsmith_gateway. The model client sends them on every request, and they replace any header of the same name set on the model. They are never stored on the model, so they are not serialized or traced. This lets a caller send a service key in X-Service-Key without it leaking into traces.

with langsmith_gateway(api_key=placeholder, headers={"X-Service-Key": service_key}):
    model = load(manifest)

Inside the context, integrations also ignore their proxy setting, so a serialized model cannot send the gateway credentials through a proxy.

Release note

langchain-core: langsmith_gateway accepts headers.

Headers passed to langsmith_gateway are sent by the model client and replace any header of the same name on the model. They are kept off the model, so they are never serialized or traced. Adds helpers integrations use to read them and to ignore their proxy inside the context.

@robin-agent robin-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Robin Review: No issues found

Robin reviewed this PR and found no potential bugs to report.

Open in Robin

@codspeed

codspeed Bot commented Nov 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 15 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing saiannam-dev/core/gateway-headers (a1f691d) with master (ccf1624)2

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on master (92c7def) during the generation of this report, so ccf1624 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs feature For PRs that implement a new feature; NOT A FEATURE REQUEST internal size: S 50-199 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant